const Controller = require('egg').Controller

class LoginController extends Controller {

  async postLogin() {
    const {ctx} = this
    let body = ctx.request.body.data
    // console.log(body);
    let loginRes = await ctx.service.login.postLogin(body)
    if(loginRes) {
      ctx.body = {
        code:20000,
        data:loginRes
      }
    }else{
      ctx.body = {
        code:50000,
        data:'用户名或密码错误'
      }
    }
  }

}

module.exports = LoginController